﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;

using Obsidian.Utils;
using Obsidian.Action;
using Obsidian.Web;
using Obsidian.Edm;
using System.Reflection;

namespace Oak.Core.Action
{
    public abstract class OakAction
    {

        private Dictionary<string, object> attacheData;

        public void SetAttacheData(Dictionary<string, object> attacheData)
        {
            this.attacheData = attacheData;
        }

        /*
        protected bool TryGetModelGene(ActionRequest request, string prmName, out ModelGene mg)
        {
            ActReqParam arp = request.GetFirstParam();
            mg = null;
            string alias;
            if (!arp.TryGetString(0, prmName, out alias))
                return false;

            string[] arrAlias = alias.Split('.');
            if (arrAlias.Length != 2)
                return false;

            string dbAlias = arrAlias[0];
            string tableAlias = arrAlias[1];
            try
            {
                mg = new ModelGene(dbAlias, tableAlias);
            }
            catch
            {
                return false;
            }

            return true;
        }

        protected object InvokeGenericMethod(object obj, string methodName, Type[] types, object[] paramenters)
        {
            MethodInfo method = obj.GetType().GetMethod(methodName);
            method = method.MakeGenericMethod(types);
            return method.Invoke(obj, paramenters);
        }

        protected object InvokeGenericMethod(object obj, string methodName, object[] paramenters)
        {
            MethodInfo method = obj.GetType().GetMethod(methodName);
            return method.Invoke(obj, paramenters);
        }
         * */

    }
}
